﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt;

    public class EnterpriseUser_Map : ClassMapping<EnterpriseUser>
    {
        public EnterpriseUser_Map()
        {
            //映射ID
            Id(x => x.Id, map =>
            {
                map.Column("user_id");
                map.Length(40);
            });

            Property(x => x.IsValid, map =>
            {
                map.Column("is_valid");
            });
            Property(x => x.CreateDate, map =>
            {
                map.Column("create_date");
            });

            Property(x => x.DesktopPhone, map =>
            {
                map.Column("user_desktopphone");
                map.Length(50);
            });
            Property(x => x.Email, map =>
            {
                map.Column("user_email");
                map.Length(200);
            });
            Property(x => x.Fax, map =>
            {
                map.Column("user_fax");
                map.Length(50);
            });
            Property(x => x.LoginName, map =>
            {
                map.Column("user_loginname");
                map.Length(40);
            });
            Property(x => x.MobilePhone, map =>
            {
                map.Column("user_mobilephone");
                map.Length(40);
            });
            Property(x => x.Password, map =>
            {
                map.Column("user_password");
                map.Length(40);
            });
            Property(x => x.Roles, map =>
            {
                map.Column("user_roles");
                map.Length(1000000);
            });
            Property(x => x.TrueNameCN, map =>
            {
                map.Column("user_truename_cn");
                map.Length(50);
            });
            Property(x => x.TrueNameEN, map =>
            {
                map.Column("user_truename_en");
                map.Length(50);
            });

            //用户所属企业
            ManyToOne(x => x.Enterprise, map =>
            {
                map.Column("ent_id");
            });

            Table("t_enterprise_user");

            //不进行创建
            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
